WKSPCDIR=$(HOME)/workspace
MAINDIR=$(WKSPCDIR)/newpargo5.0-C++
SRCDIR=${MAINDIR}/src
LIBDIR=${MAINDIR}/lib
BINDIR=${MAINDIR}/bin

# ---------------------------------------------------------------------
# Compiler options 
# ---------------------------------------------------------------------
CCOMPILER= g++ -D__cplusplus
COPT= -m32 -O2
#CCFLAGS = -I. -I$(GRAPHDIR) -I$(IPDIR)

#----------------------------------------------------------------------
# Documentation options
#----------------------------------------------------------------------
DOCTOOL = doxygen

# ---------------------------------------------------------------------
# Entries
# ---------------------------------------------------------------------

DASET=BitMapDirectlyAddressedSets
HEAP=heap
REPO=repository
GRAPH=Graph
GRAPHS=GraphInput
WGRAPHS=WGraphs
DSTDIR=datastruct
GRAPHDIR=graph
STAB=STAB

INCDIRS=$(wildcard $(SRCDIR)/*)
DIRS=$(SRCDIR)/$(DSTDIR) $(SRCDIR)/$(GRAPHDIR)

MAKEOPT=CCOMPILER="$(CCOMPILER)" COPT="$(COPT)" LIBDIR=$(LIBDIR) INCDIRS="$(INCDIRS)"

INCFLAGS=$(addprefix -I,$(INCDIRS))

deps:
	@$(foreach DIR,$(DIRS), make --directory=$(DIR) -s $(MAKEOPT);)
	
$(STAB): main.c deps Makefile
	$(CCOMPILER) ${INCFLAGS} -D_IPSOLV_ -o $(BINDIR)/$@ ${COPT} $(LIBDIR)/$(HEAP).o $(LIBDIR)/$(REPO).o $(LIBDIR)/$(GRAPH).o $(LIBDIR)/$(GRAPHS).o  main.c -lrt -pthread -lgmp $<

DOC:
	$(DOCTOOL) pargo5.0C++.doxyfile

# ------------------------------------------------------------

clean:
	/bin/rm -rf $(LIBDIR)/*.o

